<?php

require_once("Model/UserHandler.php");

class UserView 
{
	private $getRegName = "RegName";
	private $getRegPassword = "RegPassword";
	private $getRepPassword = "RegPassword";
	private $getRegSubmit = "Register";
	
	//Konstanter
	const REGISTER_CTRL_HEADER = 1;

	public function RenderHeader($header)
	{
		switch($header)
		{
			case self::REGISTER_CTRL_HEADER;
				return "<h2>Register new user</h2>";
				break;												
		}			
	}			
	
	public function RenderRegForm() 
	{
	    return $RegisterForm = 

	    "<form name='frmRegUser' id='frmRegUser' method='get'>	    		
			<p>Name:</p>			
			<input type='text' name='$this->getRegName' id='RegName' size='50' /><br/>
			<p>Password:</p>							
			<input type='password' name='$this->getRegPassword' id='RegPassword' size='50' /><br/> 	
			<p>Repeat password:</p>							
			<input type='password' name='$this->getRepPassword' id='RepPassword' size='50' /><br/>					
			
			<input type='submit' value='Register' name='$this->getRegSubmit' id='Register' />	
					  			
		</form>";
	}
	
	public function RenderUserList() 
	{
	    return NULL;
	}

	public function RenderDeleteButton() 
	{
	    return $deleteButton =
	    
		"<form name='frmLoginUser' id='frmLoginUser' method='get'>
			<input type='submit' value='Logout' name='$this->getLogoutKey' id='logout' />	    	
		</form>";
				
	}	

	public function GetRegisterName() 
	{	  	
		if (isset($_GET[$this->getRegName]) == TRUE)
		{				 		
			return $_GET[$this->getRegName];
		}
		
		return NULL;		
	}
	 
	public function GetRegisterPassword() 
	{	
		if (isset($_GET[$this->getRegPassword]) == TRUE)
		{
			return $_GET[$this->getRegPassword];
		}
				
		return NULL;			
	}

	public function GetRepeatedPassword() 
	{	
		if (isset($_GET[$this->getRepPassword]) == TRUE)
		{
			return $_GET[$this->getRepPassword];
		}
				
		return NULL;			
	}	

	public function TriedToRegister() 
	{	
		if (isset($_GET[$this->getRegSubmit]))
		{   			
			return TRUE;  	
		}
				
		return FALSE;
	   		
	}		
					       	
} 
  

?>
  